package fa.wangxing.leaf.Service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import fa.wangxing.leaf.Mapper.DishesMapper;
import fa.wangxing.leaf.Service.DishesService;
import fa.wangxing.leaf.pojo.Dishes;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.List;


@Service
public class DishesServiceimpl implements DishesService {
    @Resource
    private DishesMapper dishesMapper;

    @Override
    public List<Dishes> getDishes() {
        return dishesMapper.getDishes();
    }

    @Override
    public PageInfo<Dishes> getDishes(int pageNum) {
        PageHelper.startPage(pageNum, 5);
        List<Dishes> list = dishesMapper.getDishes();
        System.out.println(list);
        PageInfo<Dishes> pagelist = new PageInfo<>(list);
        System.out.println(pagelist);
        return pagelist;
    }
}
